//package com.zxl.grocery.webmagic.service.impl;
//
//import com.zxl.grocery.webmagic.dao.WebpageinfoDao;
//import com.zxl.grocery.webmagic.entity.WebpageinfoEntity;
//import com.zxl.grocery.webmagic.service.WebpageinfoService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import us.codecraft.webmagic.ResultItems;
//import us.codecraft.webmagic.Task;
//import us.codecraft.webmagic.pipeline.Pipeline;
//
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//
//
//@Service("webpageinfoService")
//public class WebpageinfoServiceImpl implements WebpageinfoService,Pipeline {
//	@Autowired
//	private WebpageinfoDao webpageinfoDao;
//
//	@Override
//	public WebpageinfoEntity queryObject(String id){
//		return webpageinfoDao.queryObject(id);
//	}
//
//	@Override
//	public List<WebpageinfoEntity> queryList(Map<String, Object> map){
//		return webpageinfoDao.queryList(map);
//	}
//
//	@Override
//	public int queryTotal(Map<String, Object> map){
//		return webpageinfoDao.queryTotal(map);
//	}
//
//	@Override
//	public void save(WebpageinfoEntity webpageinfo){
//		webpageinfoDao.save(webpageinfo);
//	}
//
//	@Override
//	public void update(WebpageinfoEntity webpageinfo){
//		webpageinfoDao.update(webpageinfo);
//	}
//
//	@Override
//	public void delete(String id){
//		webpageinfoDao.delete(id);
//	}
//
//	@Override
//	public void deleteBatch(String[] ids){
//		webpageinfoDao.deleteBatch(ids);
//	}
//
//    @Override
//    public void process(ResultItems resultItems, Task task) {
//        WebpageinfoEntity webpageinfoEntity=new WebpageinfoEntity();
//        Object object = resultItems.get("url");
//        if (object==null) {
//            return;
//        }
//        String id = Encrypt.md5(object+"");
//        WebpageinfoEntity queryObject = webpageinfoDao.queryObject(id);
//        if (queryObject==null) {
//            webpageinfoEntity.setId(id);
//            webpageinfoEntity.setUrl(resultItems.get("url")+"");
//            webpageinfoEntity.setTitle(resultItems.get("title")+"");
//            webpageinfoEntity.setContent(resultItems.get("content")+"");
//            webpageinfoEntity.setDate(resultItems.get("date")+"");
//            webpageinfoEntity.setAuthor(resultItems.get("author")+"");
//            webpageinfoEntity.setCreateDate(new Date());
//            webpageinfoDao.save(webpageinfoEntity);
//        }
//
//    }
//
//}
